Skip to content

Commit

Permalink
ci: improve ServerErrorHandler (#1175)
Browse files Browse the repository at this point in the history
  • Loading branch information
nsbarsukov authored Mar 29, 2024
1 parent ec86284 commit 5d364f9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions projects/demo/src/app/server-error-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ const KNOWN_ISSUES: string[] = [

@Injectable()
export class ServerErrorHandler implements ErrorHandler {
public handleError(error: Error): void {
if (KNOWN_ISSUES.some(issue => error.message.includes(issue))) {
public handleError(error: Error | string): void {
const errorMessage = (typeof error === 'string' ? error : error.message) || '';

if (KNOWN_ISSUES.some(issue => errorMessage.includes(issue))) {
return;
}

console.error(error);
console.error(errorMessage);

if (hasFlag('--ci')) {
process.exit(1);
Expand Down

0 comments on commit 5d364f9

Please sign in to comment.