<reponame>othmaan/codesandbox-clien<filename>src/sandbox/errors/sandbox-error.js<gh_stars>0
// @flow
import type { Module } from 'common/types';

type Suggestion = {
  title: string,
  action: Function,
};

export default class SandboxError extends Error {
  severity: 'error' | 'warning';
  type: string;
  module: Module;
  payload: ?Object;
  suggestions: Array<Suggestion>;

  suggestions = [];

  constructor(error: ?Error) {
    super(error ? error.message : null);

    if (error) {
      this.fileName = error.fileName;
      this.description = error.description;
      this.message = error.message;
      this.name = error.name;
      this.stack = error.stack;
      this.number = error.number;
    }
  }
}
