2

I am writing some validation in the updateparameters method of my custom geoprocessing tool. I need to post an error message when specific conditions exists and I would like to include a standard esri error code with my message. I have the logic worked out and my error message posting but I must not be using the error code correctly because no mater what number I use for the error code, it displays as -1.

enter image description here

I would like it to display error code 427.

This is the simplified code setting the error message.

 public void UpdateMessages(IArray paramvalues, IGPEnvironmentManager pEnvMgr, IGPMessages Messages)
 {
 Messages.ReplaceError(5, 427, "You're doing it wrong.");
 return;
 }
asked Nov 25, 2013 at 22:13
0

1 Answer 1

3

Try this:

var gpUtilites = new GPUtilitiesClass();
gpUtilites.SetMessage1Args(esriGPMessageType.esriGPMessageTypeError,427,
parameterValue, parameterPosition, messages);
answered Nov 29, 2013 at 4:41
5
  • 1
    Could you add a bit more explanation around this answer? Commented Nov 29, 2013 at 5:37
  • I want to draw your attention to the IGPMessageManager interface. It implemented by GPMessageManagerClass and GpUtilitiesClass. I think that is what the author is looking for. For example, it allows to get message by id and use message with custom arguments. Message can have arguments, for example 735. I tested it using it error code, and it works as the author wanted. But unfortunately it does not work specifically for 427 message. Commented Nov 29, 2013 at 7:33
  • Thats really odd. I can get it to work with id 735 but it does nothing with 427. Commented Dec 12, 2013 at 0:37
  • But I was able to get it working with SetMessage2Args and error 605. Commented Dec 12, 2013 at 0:46
  • I replaced the ReplaceError method with the following to get my desired results: var gpUtilites = new GPUtilitiesClass(); gpUtilites.SetMessage2Args(esriGPMessageType.esriGPMessageTypeError, 605, outFCName, outLocation, _outFCName.DisplayOrder, Messages); Commented Dec 12, 2013 at 0:46

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.