File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
packages/clerk-js/src/core Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -1351,12 +1351,15 @@ export class Clerk implements ClerkInterface {
13511351 const newLastActiveOrganizationId = matchingOrganization ?. organization . id || null ;
13521352 const isPersonalWorkspace = newLastActiveOrganizationId === null ;
13531353
1354- // If a slug was explicitly provided but doesn't match any organization, throw an error
1355- if ( organizationIdOrSlug && ! matchingOrganization ) {
1356- throw new Error (
1357- `Unable to find organization with slug "${ organizationIdOrSlug } ". The user is not a member of this organization or it does not exist.` ,
1358- ) ;
1359- }
1354+ const INVALID_ORGANIZATION_SLUG_ERROR_CODE = 'invalid_organization_slug' ;
1355+
1356+ // If a slug was explicitly provided but doesn't match any organization, throw an error
1357+ if ( organizationIdOrSlug && ! matchingOrganization ) {
1358+ throw new ClerkRuntimeError (
1359+ `Unable to find organization with slug "${ organizationIdOrSlug } ". The user is not a member of this organization or it does not exist.` ,
1360+ { code : INVALID_ORGANIZATION_SLUG_ERROR_CODE }
1361+ ) ;
1362+ }
13601363
13611364 // Do not update in-memory to personal workspace if force organization selection is enabled
13621365 if ( this . environment ?. organizationSettings ?. forceOrganizationSelection && isPersonalWorkspace ) {
You can’t perform that action at this time.
0 commit comments