diff --git a/.changeset/guard-empty-error-list-role-helper.md b/.changeset/guard-empty-error-list-role-helper.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/guard-empty-error-list-role-helper.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/integration/testUtils/bulkCreateFeaturesPermissionsRoles.ts b/integration/testUtils/bulkCreateFeaturesPermissionsRoles.ts index 619b41caf61..72cbdfb8610 100644 --- a/integration/testUtils/bulkCreateFeaturesPermissionsRoles.ts +++ b/integration/testUtils/bulkCreateFeaturesPermissionsRoles.ts @@ -58,11 +58,11 @@ export async function bulkCreateFeaturesPermissionsRoles( permissionId, }); } catch (err: unknown) { + if (!isClerkAPIResponseError(err)) { + throw err; + } // we are okay if the error is assigning an existing permission - if ( - isClerkAPIResponseError(err) && - err.errors[0].code !== 'organization_role_permission_association_exists' - ) { + if (err.errors[0]?.code !== 'organization_role_permission_association_exists') { throw err; } }