Skip to content
Snippets Groups Projects
Select Git revision
  • 18583969385629f785da8a91cee74c4338041fb7
  • master default protected
  • 1.31
  • 4.24.3
  • 4.24.2
  • 4.24.1
  • 4.24.0
  • 4.23.6
  • 4.23.5
  • 4.23.4
  • 4.23.3
  • 4.23.2
  • 4.23.1
  • 4.23.0
  • 4.22.3
  • 4.22.2
  • 4.22.1
  • 4.22.0
  • 4.21.0
  • 4.20.1
  • 4.20.0
  • 4.19.0
  • 4.18.0
23 results

writeerror.mjs

Blame
  • writeerror.mjs 1.10 KiB
    
    
    /**
     * Copyright schukai GmbH and contributors 2022. All Rights Reserved.
     * Node module: @schukai/monster
     * This file is licensed under the AGPLv3 License.
     * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
     */
    
    
    import {internalSymbol} from "../../../constants.mjs";
    
    export {WriteError}
    
    /**
     * Error message for API requests with extension of request and validation.
     * 
     * @license AGPLv3
     * @since 1.24.0
     * @copyright schukai GmbH
     * @memberOf Monster.Data.Datasource.RestAPI
     * @summary the error is thrown by the rest api in case of error
     */
    class WriteError extends Error {
        /**
         *
         * @param {string} message
         * @param {Response} response
         */
        constructor(message, response, validation) {
            super(message);
            this[internalSymbol] = {
                response: response,
                validation: validation
            };
        }
    
        /**
         * @return {Response}
         */
        getResponse() {
            return this[internalSymbol]['response']
        }
    
        /**
         * @return {Object}
         */
        getValidation() {
            return this[internalSymbol]['validation']
        }
    }