'use strict';
import ExtendableError from 'es6-error';

export class ProjectNotFoundError extends ExtendableError {
  constructor (message = 'Project not found', extra) {
    super(message);
    this.extra = extra;
  }
}

export class ScenarioNotFoundError extends ExtendableError {
  constructor (message = 'Scenario not found', extra) {
    super(message);
    this.extra = extra;
  }
}

export class FileNotFoundError extends ExtendableError {
  constructor (message = 'File not found', extra) {
    super(message);
    this.extra = extra;
  }
}

export class FileExistsError extends ExtendableError {
  constructor (message = 'File already exists', extra) {
    super(message);
    this.extra = extra;
  }
}

export class ProjectStatusError extends ExtendableError {
  constructor (message, extra) {
    super(message);
    this.extra = extra;
  }
}

export class DataConflictError extends ExtendableError {
  constructor (message, extra) {
    super(message);
    this.extra = extra;
  }
}

export class MasterScenarioError extends ExtendableError {
  constructor (message, extra) {
    super(message);
    this.extra = extra;
  }
}

export class DataValidationError extends ExtendableError {
  constructor (message, extra) {
    super(message);
    this.extra = extra;
  }
}

@@ -47,16 +47,41 @@
 -error';
+%0Aimport Boom from 'boom';
 %0A%0Aexport
@@ -1279,28 +1279,1096 @@
   this.extra = extra;%0A  %7D%0A%7D%0A
+%0Aexport class DisabledServiceError extends ExtendableError %7B%0A  constructor (message, extra) %7B%0A    super(message);%0A    this.extra = extra;%0A  %7D%0A%7D%0A%0A/**%0A * Gets the appropriate Boom response for the given error. Can be passed%0A * directly to the reply interface.%0A * This function is specially useful when workin with try/catch blocks that can%0A * throw multiple errors.%0A *%0A * @param %7BError%7D error Error object%0A *%0A * @returns Boom response%0A */%0Aexport function getBoomResponseForError (error) %7B%0A  // Check for known error types.%0A  if (error instanceof FileNotFoundError) return Boom.notFound(error.message);%0A  if (error instanceof ProjectNotFoundError) return Boom.notFound(error.message);%0A  if (error instanceof ScenarioNotFoundError) return Boom.notFound(error.message);%0A  if (error instanceof DataConflictError) return Boom.conflict(error.message);%0A%0A  // Check for known error codes.%0A  if (error.code === 'NoSuchKey') return Boom.notFound('File not found in storage bucket');%0A%0A  // Default handling.%0A  console.log('error', error);%0A  return Boom.badImplementation(error);%0A%7D%0A

Add new error handling system for try catch blocks