Contents
Contents

OnError Handlers

Struggling to bridge the legacy gap? Cedar Hills Group provides specialized PeopleSoft integration consulting to help teams design, build, and optimize their connection strategies.

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).

Synchronous REST Operations (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 Definition

interface IRequestHandler
   method OnRequest(&message As Message) Returns Message;
   method OnError(&request As Message) Returns string;
   property integer OnErrorHttpResponseCode;
   property string OnErrorContentType;
end-interface;

REST Implementation Example

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;

Synchronous SOAP / Non-REST Operations

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:

  • If the return string is already XML SOAP formatted, Integration Broker returns it directly as the SOAP response.
  • If the return string is plain text, Integration Broker wraps it in a <soapenv:Fault> structure.

Asynchronous Operations (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:

  • Log custom debugging context to an application error log table or file.
  • Send an administrative email or notification alert.
  • Inspect &request.IBException to decide whether to record additional diagnostic information before the contract is placed into Error status in the Service Operation Monitor.
psLens Platform
psLens Operations & Intelligence

Look up any record, field, page, or component, audit security, and monitor Integration Broker across every database — in seconds.

  • 30+ object types browsable
  • 16 real-time alert types
  • Read-only by design
  • No App Designer or SQL required
Learn More
psLens Platform
psLens Operations & Intelligence

A web console built for the PeopleSoft community — operational monitoring, security auditing, and metadata browsing in one tool.

  • Sub-second object search
  • Catch stuck IB messages before users do
  • Audit service permissions from one screen
  • Works in any browser
Learn More
psLens Platform
psLens Operations & Intelligence

On-demand security and operational reports for your PeopleSoft environment — no client install required.

  • 14 on-demand reports
  • Markdown export for AI/LLM workflows
  • No shared tenancy
  • Built on 25+ years of PeopleSoft expertise
Learn More
psLens Platform
psLens Operations & Intelligence

Research any PeopleSoft object and monitor system health from a single browser tab — no App Designer, no SQL.

  • 30+ PeopleSoft object types browsable
  • Real-time alerts before users report problems
  • Read-only and secure
  • Private alpha — early access now
Learn More
Author Profile
Chris Malek

Chris Malek is a PeopleTools® Technical Consultant with over two decades of experience. He is available for consulting engagements.

Work with Chris
Subscribe to Updates
SWS Bolt-On
PeopleSoft Simple Web Services

SWS turns SQL into production REST APIs — ready for AI, modern apps, and partner integrations. One install, unlimited potential.

  • Configuration-driven, no coding required
  • JSON, XML, and CSV output
  • Works across all PeopleSoft pillars
  • Built on 25+ years of PeopleSoft expertise
Read More & Purchase
SWS Bolt-On
PeopleSoft Simple Web Services

A powerful PeopleSoft bolt-on that makes REST web services easy. You bring the SQL, SWS handles the rest.

  • Go from idea to production in minutes
  • Zero code migrations after install
  • JSON, XML, and CSV output supported
  • No PeopleCode or Integration Broker expertise required
Read More & Purchase
SWS Bolt-On
PeopleSoft Simple Web Services

Traditional PeopleSoft web services cost $3,600–$13,000 each to develop. SWS deploys production REST APIs in under 5 minutes through configuration alone.

  • No PeopleCode or Integration Broker expertise required
  • Works across Campus Solutions, HCM, and Financials
  • Built-in pagination, caching, and nested data structures
  • Trusted by institutions across higher education and government
Read More & Purchase
SWS Bolt-On
PeopleSoft Simple Web Services

Turn PeopleSoft data into clean REST APIs for AI integrations, modern applications, and vendor data feeds. Configuration-driven — no PeopleCode required.

  • Deploy production APIs in under 5 minutes
  • AI and LLM ready (RAG, chatbots, intelligent search)
  • JSON, XML, and CSV output
  • Zero modifications to delivered PeopleSoft objects
Read More & Purchase