skills/error-handling-frontend-angular/SKILL.md
Implement consistent Angular error handling with ErrorHandler, HTTP interceptors, user-friendly error states, and toast notifications. Use when: creating global ErrorHandler, handling HTTP errors in interceptors, building retry UI, or showing error toasts in Angular apps.
npx skillsauth add congiuluc/my-awesome-copilot error-handling-frontend-angularInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
ErrorHandler for uncaught errorsErrorHandler implementationresponse.success and response.errorimport { ErrorHandler, Injectable, inject } from '@angular/core';
@Injectable()
export class GlobalErrorHandler implements ErrorHandler {
handleError(error: unknown): void {
console.error('Unhandled error:', error);
// Send to telemetry service if available
}
}
// Register in app.config.ts:
// providers: [{ provide: ErrorHandler, useClass: GlobalErrorHandler }]
import { HttpInterceptorFn, HttpErrorResponse } from '@angular/common/http';
import { catchError, throwError } from 'rxjs';
import { inject } from '@angular/core';
export const errorInterceptor: HttpInterceptorFn = (req, next) => {
return next(req).pipe(
catchError((error: HttpErrorResponse) => {
let message = 'An unexpected error occurred.';
if (error.status === 0) {
message = 'Network error. Please check your connection.';
} else if (error.status === 404) {
message = 'Resource not found.';
} else if (error.status >= 500) {
message = 'Server error. Please try again later.';
}
// Show toast notification
console.error(message, error);
return throwError(() => new Error(message));
})
);
};
@Component({
template: `
@if (loading()) {
<app-spinner aria-label="Loading" />
} @else if (error()) {
<app-error-message [message]="error()!" (retry)="load()" />
} @else if (items().length === 0) {
<app-empty-state message="No items found" />
} @else {
<!-- render items -->
}
`
})
export class ItemListComponent {
readonly items = signal<Item[]>([]);
readonly loading = signal(true);
readonly error = signal<string | null>(null);
}
response.successtools
Build VS Code extensions with TypeScript. Covers extension anatomy, activation events, commands, tree views, webview panels, language features, testing, and publishing. Use when: creating a new VS Code extension, adding commands/views/providers, building webview UIs, implementing language server features, testing extensions, or packaging for the marketplace.
development
Track implementations, features, bugs, and releases in a versioning document. Use when: adding a commit, completing a feature, fixing a bug, or preparing a release. Automatically updates CHANGELOG.md following Keep a Changelog format and Semantic Versioning.
development
Write frontend tests using Vitest and React Testing Library. Use when: testing React components, hooks, user interactions, form submissions, accessibility assertions, or mocking API services.
development
Write Angular frontend tests using Jasmine, Karma, and Angular TestBed. Use when: testing Angular components, services, pipes, directives, user interactions, form submissions, accessibility assertions, or mocking HTTP services.