Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions controller/SkosmosExceptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

/**
* Handles all the self-made exceptions
*/

class TimeoutException extends RuntimeException {
// protected static $message = "EXCEPTION: This is a message for ...";

public static function throwExceptionMessage() {
echo("EXCEPTION: This is a message for ...");
}
}

12 changes: 9 additions & 3 deletions rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
* Includes the side wide settings.
*/
require_once 'vendor/autoload.php';

// Must be handled with Autoload later on ..
require_once 'controller/SkosmosExceptions.php';
//require_once __DIR__ . '/controller/SkosmosExceptions.php';
header("Access-Control-Allow-Origin: *"); // enable CORS for the whole REST API

try {
Expand Down Expand Up @@ -106,7 +108,11 @@
echo ("404 Not Found");
}
}
} catch (Exception $e) {
//} catch (Exception $e) {
// header("HTTP/1.0 500 Internal Server Error");
// echo('ERROR: ' . $e->getMessage());
//}
}catch(Exception $e) {
header("HTTP/1.0 500 Internal Server Error");
echo('ERROR: ' . $e->getMessage());
echo(TimeoutException::throwExceptionMessage());
}