File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import Joi from 'joi'
2
2
3
3
class ValidationError extends Error {
4
4
constructor ( message , details ) {
5
- super ( message )
5
+ super ( ` ${ message } : ${ details . map ( ( d ) => d . message ) . join ( ', ' ) } ` )
6
6
this . name = 'ValidationError'
7
7
this . details = details
8
8
}
@@ -51,18 +51,18 @@ async function validateConfig(config) {
51
51
// Validate the config against the schema
52
52
const { error } = schema . validate ( config )
53
53
if ( error ) {
54
- throw new ValidationError ( 'Validation Error ' , error . details )
54
+ throw new ValidationError ( 'Incorrect configuration ' , error . details )
55
55
}
56
56
return true
57
57
} catch ( err ) {
58
58
if ( err instanceof ValidationError ) {
59
- console . error ( 'Validation Error:' , err . message )
59
+ console . error ( 'Validation Error: ' , err . message )
60
60
throw err
61
61
} else if ( err . message . includes ( 'ENOENT: no such file or directory' ) ) {
62
62
console . error ( 'Error reading file:' , err . message )
63
63
throw err
64
64
} else {
65
- console . error ( 'Other Validation Error:' , err . message )
65
+ console . error ( 'Other Validation Error: ' , err . message )
66
66
throw err
67
67
}
68
68
return false
You can’t perform that action at this time.
0 commit comments