Open topic with navigation

TIBCO® Enterprise Administrator 2.4.2

# Coding Exceptions in Agent Operations

When an operation method throws an exception, you can either use the implicit status code associated with the exception class, or encode the HTTP status code explicitly.

Procedure
1. Create and throw an exception object.

       final String errorMessage = MessageFormat.format(
           "Cannot start web application ''{0}'' because it is already running.",
              tomcatWebAppConfig.getName());
       throw new TeaIllegalStateException(errorMessage);

2. Optional. Supply an explicit status code (which overwrites the implicit status code).
   You must not supply 303 as an explicit status code. Status 303 has special meaning for the server.

       throw new TeaIllegalStateException("Too many requests").withHttpStatusCode(429);

3. Optional. Supply an explicit exit code for the shell interface.
   In the shell interface an operation returns an exit code when it returns in error. When constructing the exception in your operation method, you may supply a positive integer as the shell exit code.

   If you do not supply an explicit exit code, the shell command returns an implicit exit code that is appropriate to the return status of the operation.

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO® Enterprise Administrator

Copyright © 1996-2025. Cloud Software Group, Inc. All Rights Reserved.