This repository was archived by the owner on Sep 16, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 11const _ = require ( 'lodash' ) ;
22const { getPluginService } = require ( '../utils/getPluginService' ) ;
3+ const { ValidationError } = require ( '@strapi/utils' ) . errors ;
34
45const getCustomTypes = ( strapi , nexus ) => {
56 const { naming } = getPluginService ( strapi , 'utils' , 'graphql' ) ;
@@ -45,15 +46,17 @@ const getCustomTypes = (strapi, nexus) => {
4546 modelName : nexus . stringArg ( 'The model name of the content type' ) ,
4647 slug : nexus . stringArg ( 'The slug to query for' ) ,
4748 } ,
48- resolve : async ( _ , args ) => {
49+ resolve : async ( _parent , args ) => {
4950 const { models } = getPluginService ( strapi , 'settingsService' ) . get ( ) ;
5051 const { modelName, slug } = args ;
5152
5253 const model = models [ modelName ] ;
5354
5455 // ensure valid model is passed
5556 if ( ! model ) {
56- return toEntityResponse ( null , { resourceUID : uid } ) ;
57+ throw new ValidationError (
58+ `${ modelName } model name not found, all models must be defined in the settings and are case sensitive.`
59+ ) ;
5760 }
5861
5962 const { uid, field, contentType } = model ;
You can’t perform that action at this time.
0 commit comments