nus-mtp/sashimi-note

View on GitHub
sashimi-webapp/src/database/exceptions.js

Summary

Maintainability
B
4 hrs
Test Coverage
/**
 *
 *  CS3283/4 exceptions.js
 *  This class is to store all the exceptions required for database
 *
 */

export default Object.freeze({
  TableCreationAlreadyInitiated: function TableCreationAlreadyInitiated(message) {
    this.message = message || 'Exception: table creation thread is not closed.';
    this.name = 'TableCreationAlreadyInitiated';
    this.stack = (new Error()).stack;
  },

  IndexedDBNotSupported: function IndexedDBNotSupported(message) {
    this.message = message || 'Exception: IndexedDB not supported on this browser.';
    this.name = 'IndexedDBNotSupported';
    this.stack = (new Error()).stack;
  },

  IndexedDBOnBlock: function IndexedDBOnBlock(message) {
    this.message = message || 'Exception: IndexedDB thread blocked.';
    this.name = 'IndexedDBOnBlock';
    this.stack = (new Error()).stack;
  },

  InvalidRename: function InvalidRename(message) {
    this.message = message || 'Exception: Invalid name that violates SQL injection';
    this.name = 'InvalidRename';
    this.stack = (new Error()).stack;
  }
});