The OnError method provides custom exception handling when an unhandled error or explicit exception occurs during message processing. It is defined as a method across all standard Integration Broker application class interfaces (IRequestHandler, INotificationHandler, IRouter, IReceiver, and IPrePostNotification).
IRequestHandler)In REST-based synchronous operations, an error that throws an exception can be intercepted to return a specific HTTP status code (such as 400 Bad Request, 404 Not Found, or 500 Internal Server Error) along with a customized response payload (JSON or XML).
interface IRequestHandler
method OnRequest(&message As Message) Returns Message;
method OnError(&request As Message) Returns string;
property integer OnErrorHttpResponseCode;
property string OnErrorContentType;
end-interface;
import PS_PT:Integration:IRequestHandler;
class UserHandler implements PS_PT:Integration:IRequestHandler
method OnRequest(&Msg As Message) Returns Message;
method OnError(&Msg As Message) Returns string;
property integer OnErrorHttpResponseCode;
property string OnErrorContentType;
end-class;
method OnRequest
/+ &Msg as Message +/
/+ Returns Message +/
/+ Extends/implements PS_PT:Integration:IRequestHandler.OnRequest +/
Local string &emplid = &Msg.GetContentString();
/* Validate business rule */
If &emplid = "" Then
%This.OnErrorHttpResponseCode = 400;
%This.OnErrorContentType = "application/json";
throw CreateException(0, 0, "{""error"": ""EmplID parameter is required""}");
End-If;
/* Process request... */
Return &responseMsg;
end-method;
method OnError
/+ &Msg as Message +/
/+ Returns String +/
/+ Extends/implements PS_PT:Integration:IRequestHandler.OnError +/
/* If returning a custom string, it will be sent back directly as response body */
Return &Msg.IBException.ToString();
end-method;
If no custom OnError handler returns a custom payload, or if an unhandled PeopleCode exception is thrown in a non-REST operation:
throw CreateException(158, 10001, "Custom error message");
Integration Broker wraps the error into a standard PeopleSoft XML error envelope with HTTP 200 (or SOAP Fault if invoked via SOAP):
HTTP/1.1 200 OK
Content-Type: text/xml; charset=UTF-8
<?xml version="1.0"?>
<IBResponse type="error">
<DefaultTitle>Integration Broker Response</DefaultTitle>
<StatusCode>20</StatusCode>
<MessageSet>158</MessageSet>
<MessageID>10001</MessageID>
<DefaultMessage>Custom error message</DefaultMessage>
</IBResponse>
If the OnError method returns a string in a SOAP operation:
<soapenv:Fault> structure.INotificationHandler, IRouter, IReceiver)In asynchronous subscription and routing handlers, OnError receives the inbound &request As Message containing the exception details in &request.IBException.
Because the caller is not waiting synchronously for a response, OnError in asynchronous handlers is typically used to:
&request.IBException to decide whether to record additional diagnostic information before the contract is placed into Error status in the Service Operation Monitor.Look up any record, field, page, or component, audit security, and monitor Integration Broker across every database — in seconds.
A web console built for the PeopleSoft community — operational monitoring, security auditing, and metadata browsing in one tool.
On-demand security and operational reports for your PeopleSoft environment — no client install required.
Research any PeopleSoft object and monitor system health from a single browser tab — no App Designer, no SQL.
Chris Malek is a PeopleTools® Technical Consultant with over two decades of experience. He is available for consulting engagements.
Work with ChrisSWS turns SQL into production REST APIs — ready for AI, modern apps, and partner integrations. One install, unlimited potential.
A powerful PeopleSoft bolt-on that makes REST web services easy. You bring the SQL, SWS handles the rest.
Traditional PeopleSoft web services cost $3,600–$13,000 each to develop. SWS deploys production REST APIs in under 5 minutes through configuration alone.
Turn PeopleSoft data into clean REST APIs for AI integrations, modern applications, and vendor data feeds. Configuration-driven — no PeopleCode required.