UNPKG

829 BJavaScriptView Raw
1"use strict";
2/*
3 * @adonisjs/fold
4 *
5 * (c) Harminder Virk <virk@adonisjs.com>
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10Object.defineProperty(exports, "__esModule", { value: true });
11exports.InvalidInjectionException = void 0;
12const utils_1 = require("@poppinss/utils");
13/**
14 * Raised when trying to inject a primitive value like "StringConstructor"
15 * to a class constructor or method
16 */
17class InvalidInjectionException extends utils_1.Exception {
18 static invoke(value, parentName, index) {
19 const primitiveName = `{${value.name} Constructor}`;
20 return new this(`Cannot inject "${primitiveName}" to "${parentName}" at position "${index + 1}"`);
21 }
22}
23exports.InvalidInjectionException = InvalidInjectionException;