Handling Errors with try-catch-finally
What error handling practice is shown here?
class ValidationError extends Error {
constructor(message) {
super(message);
this.name = 'ValidationError';
}
}
try {
throw new ValidationError('Invalid input');
} catch (error) {
if (error instanceof ValidationError) {
// Handle validation error
}
}