Skip to content

Commit

Permalink
Address hugh's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
forgetso committed Dec 10, 2024
1 parent f046804 commit 46fc678
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion dev/config/src/vite/vite.test.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export default function () {
},
pool: "forks", // forks is slower than 'threads' but more compatible with low-level libs (e.g. bcrypt)
testTimeout: 10000,
//disableConsoleIntercept: true,
},
plugins: [
VitePluginSourcemapExclude({ excludeNodeModules: true }),
Expand Down
8 changes: 4 additions & 4 deletions packages/common/src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ export class ProsopoApiError extends ProsopoBaseError<ApiContextParams> {
}
}

export const unwrapError = (err: ProsopoApiError | SyntaxError | ZodError) => {
const code = "code" in err ? err.code : 400;
export const unwrapError = (err: ProsopoBaseError | SyntaxError | ZodError) => {
const code = "code" in err ? (err.code as number) : 400;
let message = i18next.t(err.message);
let jsonError: ApiJsonError = { code, message };
let statusMessage = err.message;
Expand Down Expand Up @@ -215,8 +215,8 @@ export const unwrapError = (err: ProsopoApiError | SyntaxError | ZodError) => {
return { code, statusMessage, jsonError };
};

export function isZodError(err: unknown): err is ZodError {
export const isZodError = (err: unknown): err is ZodError => {
return Boolean(
err && (err instanceof ZodError || (err as ZodError).name === "ZodError"),
);
}
};

0 comments on commit 46fc678

Please sign in to comment.