How to get raw Exception Message in Laravel?

Last Updated: March 15, 2020

If you want to get raw exception message without HTML code in Laravel you can use the following method


This is the sample code for it


// some code here

} catch (\Exception $e) {

  return response()->json(['type' => 'warn', 'title' => "Unable to Create Contact", "message" => $e->getMessage()]);