Adding custom error in a published geoprocessing service using ArcPy?

631
2
10-12-2016 12:34 PM
MaximeDemers
Occasional Contributor III

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"
        }
    }
    

0 Kudos
2 Replies
MarcoAntonioCosta
New Contributor

@MaximeDemers did you find any solution for this?

0 Kudos
MaximeDemers
Occasional Contributor III

Hi Marco,

No I did not found a solution, but I did not search really further. Maybe with SOE or SOI it would be possible. https://developers.arcgis.com/enterprise-sdk/guide/net/overview-of-developing-soes-net/