File tree Expand file tree Collapse file tree 3 files changed +10
-10
lines changed
Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -16,15 +16,15 @@ const assignArguments = context => {
1616} ;
1717
1818const validate = context => {
19- const { service, method } = context ;
19+ const { service, method, path } = context ;
2020 const parameters = service . methods [ method ] ;
2121
2222 if ( parameters . includes ( 'id' ) && context . id === undefined ) {
23- throw new Error ( `An id must be provided to the '${ method } ' method` ) ;
23+ throw new Error ( `An id must be provided to the '${ path } . ${ method } ' method` ) ;
2424 }
2525
2626 if ( parameters . includes ( 'data' ) && ! _ . isObjectOrArray ( context . data ) ) {
27- throw new Error ( `A data object must be provided to the '${ method } ' method` ) ;
27+ throw new Error ( `A data object must be provided to the '${ path } . ${ method } ' method` ) ;
2828 }
2929
3030 return context ;
Original file line number Diff line number Diff line change @@ -18,11 +18,11 @@ describe('hooks basics', () => {
1818
1919 return app . service ( 'dummy' ) . get ( ) ;
2020 } ) . catch ( e => {
21- assert . strictEqual ( e . message , `An id must be provided to the 'get' method` ) ;
21+ assert . strictEqual ( e . message , `An id must be provided to the 'dummy. get' method` ) ;
2222 } ) . then ( ( ) =>
2323 app . service ( 'dummy' ) . create ( )
2424 ) . catch ( e => {
25- assert . strictEqual ( e . message , `A data object must be provided to the 'create' method` ) ;
25+ assert . strictEqual ( e . message , `A data object must be provided to the 'dummy. create' method` ) ;
2626 } ) ;
2727 } ) ;
2828
@@ -201,7 +201,7 @@ describe('hooks basics', () => {
201201 assert . strictEqual ( context . service , app . service ( 'dummy' ) ) ;
202202 assert . strictEqual ( context . type , 'error' ) ;
203203 assert . strictEqual ( context . path , 'dummy' ) ;
204- assert . strictEqual ( context . error . message , 'An id must be provided to the \'get\' method' ) ;
204+ assert . strictEqual ( context . error . message , 'An id must be provided to the \'dummy. get\' method' ) ;
205205 } ) ;
206206 } ) ;
207207
Original file line number Diff line number Diff line change @@ -79,19 +79,19 @@ describe('REST client tests', function () {
7979 const service = app . service ( 'todos' ) ;
8080
8181 return service . get ( ) . catch ( error => {
82- assert . strictEqual ( error . message , `An id must be provided to the 'get' method` ) ;
82+ assert . strictEqual ( error . message , `An id must be provided to the 'todos. get' method` ) ;
8383
8484 return service . remove ( ) ;
8585 } ) . catch ( error => {
86- assert . strictEqual ( error . message , `An id must be provided to the 'remove' method` ) ;
86+ assert . strictEqual ( error . message , `An id must be provided to the 'todos. remove' method` ) ;
8787
8888 return service . update ( ) ;
8989 } ) . catch ( error => {
90- assert . strictEqual ( error . message , `An id must be provided to the 'update' method` ) ;
90+ assert . strictEqual ( error . message , `An id must be provided to the 'todos. update' method` ) ;
9191
9292 return service . patch ( ) ;
9393 } ) . catch ( error => {
94- assert . strictEqual ( error . message , `An id must be provided to the 'patch' method` ) ;
94+ assert . strictEqual ( error . message , `An id must be provided to the 'todos. patch' method` ) ;
9595 } ) ;
9696 } ) ;
9797} ) ;
You can’t perform that action at this time.
0 commit comments