Use isError from @backstage/errors instead of instanceof Error

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
This commit is contained in:
Fredrik Adelöw
2026-04-14 14:10:31 +02:00
parent b91223faf8
commit c51c6eb81c
@@ -14,6 +14,7 @@
* limitations under the License.
*/
import { isError } from '@backstage/errors';
import { JsonObject } from '@backstage/types';
import { z } from 'zod/v3';
import { isJsonObjectDeep } from './util';
@@ -33,7 +34,7 @@ export const jsonSchemaSchema = z
} catch (error) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: error instanceof Error ? error.message : 'Invalid JSON schema',
message: isError(error) ? error.message : 'Invalid JSON schema',
});
return false;
}