JavaScript
Check error type

by Benny Neugebauer

if (error.name === 'ValidationUtilError') {
  this.logger.error(`Failed to validate an asset URL: ${error.message}`);
  return false;
}

if (error instanceof z.util.ValidationUtilError) {
  this.logger.error(`Failed to validate an asset URL: ${error.message}`);
  return false;
}