docs: function thorinErrorWrapper(a, b, c, d) {
      if (a instanceof ThorinError.generic) return a;
      if (a instanceof Error) {
        let e = new ThorinError.generic(a.code || 'GENERIC_ERROR');
        e.source = a;
        if (a.statusCode) {
          e.statusCode = a.statusCode;
          if (a.message) {
            e.message = a.message;
          }
        } else {
          e.statusCode = 500;
        }
        if (typeof a.data !== 'undefined') {
          e.data = a.data;
        }
        // Check if we have a Sequelize error.
        return e;
      }
      if (typeof a === 'string' && !b && !c) { // code
        return new ThorinError.generic(a);
      }
      if (typeof a === 'string' && typeof b === 'string' && !c) {  //code,message
        let e = new ThorinError.generic(a, b);
        if (typeof d === 'number') {
          e.statusCode = d;
        }
        return e;
      }
      if (typeof a === 'string' && typeof b === 'string' && typeof c === 'number') { // code,message,statusCode
        let e = new ThorinError.generic(a, b);
        e.statusCode = c;
        if (typeof d === 'object' && d != null) {
          e.data = d;
        }
        return e;
      }
      if (typeof a === 'string' && typeof b === 'string') {
        let e = new ThorinError.generic(a, b);
        if (c instanceof Error) {
          e.source = c;
        } else if (typeof c === 'object' && c != null) {
          e.data = c;
        }
        if (typeof d === 'number') {
          e.statusCode = d;
        }
        return e;
      }
      return new ThorinError.generic();
    }