An optional object consists of optional link, min, max, and type properties to define the error message.
link - The link to read more about the thrown error replaceable on the given template as {link} tag.
max - The maximum number replaceable on the given template as {max} tag.
min - The minimum number is replaceable on the given template as {min} tag.
type - The type indicates the expected type that isn't throwing an error or the not expected type that is throwing an error replaceable on the given template as the {type} tag.
Example usage
Basic usage
Example with the given required problem and fix.
// Example usage.import { CommonError } from'@angular-package/error';// Create `TestError` to extend.classTestError<Idextendsstring> extendsCommonError<Id> {}// Uncaught Error: Problem: problem => Fix: fixthrownewTestError('problem','fix');
id
Example with the given id.
// Example usage.import { CommonError } from'@angular-package/error';// Create `TestError` to extend.classTestError<Idextendsstring> extendsCommonError<Id> {}// Uncaught Error: Problem(AE:427): problem => Fix: fixthrownewTestError('problem','fix','(AE:427)'// <--- Parameter `id`.);
Example with the given id, template and property min of additional.
// Example usage.import { CommonError } from'@angular-package/error';// Create `TestError` to extend.classTestError<Idextendsstring> extendsCommonError<Id> {}// Uncaught Error: (AE:427)Age must be above 9. Provide age more than 9thrownewTestError('Age must be above ',// Problem'Provide age more than ',// Fix'AE:427',// Identification'({id}){problem}{min}. {fix}{min}',// Template { min:9 } // Additional);
id, template, additional{ min, max }
Example with the given id, template and property min and max of additional.
// Example usage.import { CommonError } from'@angular-package/error';// Create `TestError` to extend.classTestError<Idextendsstring> extendsCommonError<Id> {}// Uncaught Error: (AE:427)The `age` parameter is 45. Provided `age` must be between 9 and 12thrownewTestError('The `age` parameter is 45.',// Problem'Provided `age` must be',// Fix'AE:427',// Identification'({id}){problem} {fix} between {min} and {max}',// Template { min:9, max:12 } // Additional);
id, template, additional{ min, max, type }
Example with the given id, template, property min, max and type of additional.
// Example usage.import { CommonError } from'@angular-package/error';// Create `TestError` to extend.classTestError<Idextendsstring> extendsCommonError<Id> {}// Uncaught Error: (AE:427)The `age` parameter is not a number. Provided `age` must be a number between 9 and 12.thrownewTestError('The `age` parameter is not a',// Problem'Provided `age` must be a ',// Fix'AE:427',// Identification'({id}){problem} {type}. {fix} {type} between {min} and {max}.',// Template { min:9, max:12, type:'number' } // Additional);