AnsweredAssumed Answered

Adding custom error in  a published geoprocessing service using ArcPy?

Question asked by DemersM on Oct 12, 2016

Is it possible to replace the default arcpy error message with a custom message using `arcpy.AddError(msg)` or else for a GP Service published into ArcGIS Server?

 

if I use:

 

    arcpy.AddError("This is my custom error message")

 

My custom message only appears printed in the details. like this: (sorry its in french):

 

    {
       error : {
           code: 400,
           message: "Unable to complete operation.",
           details: [
                      "Erreur d’exécution de l’outil. AppLogin Job ID:    
                          jfe0aa728897644eb9344fa9fc7a48864 : This is my custom error message
                          Échec de l’exécution de (AppLogin).
                          Échec de l’exécution de (AppLogin)."
            ]
    }

 

What I want instead its just:

 

    {
        error : {
            code : 400,
            message : "This is my custom error message"
        }
    }
    

Outcomes