Exception Class

The IPC_Exception class extends the base PHP Exception and is used throughout the myPOS IPC SDK to signal runtime errors such as invalid configurations, failed connections, or unexpected API responses.

Class Info

  • Namespace: Mypos\IPC
  • Located at: IPC_Exception.php
  • Extends: \Exception
  • Implements: \Throwable
  • Purpose: Handles all SDK-level and runtime exceptions in the IPC framework

Method Summary (Inherited from Exception)

MethodDescription
__construct()Initializes the exception with a message, code, and optional previous throwable.
getMessage()Returns the exception message.
getCode()Returns the exception code.
getFile()Returns the file where the exception was thrown.
getLine()Returns the line number where the exception was thrown.
getTrace()Returns the stack trace as an array.
getTraceAsString()Returns the stack trace as a string.
getPrevious()Returns the previous throwable, if nested.
__toString()Returns a string representation of the exception.

Properties Summary

PropertyDescription
$messageException message.
$codeException code.
$fileFile in which the exception was thrown.
$lineLine number where the exception occurred.

Example Usage

 <?php

 namespace Mypos\IPC;

 class IPC_Exception extends \Exception
 {
     #TODO
 }

Use cases

Use IPC_Exception to:

  • Catch and handle SDK-specific errors gracefully
  • Log failures in purchase, refund, or card storage operations
  • Debug IPC configuration issues (missing keys, invalid params)
  • Enhance user experience by avoiding fatal crashes