diff --git a/restful.module b/restful.module index 2821e3ec..25cba3bb 100644 --- a/restful.module +++ b/restful.module @@ -527,6 +527,17 @@ function restful_menu_process_callback($resource_name, $version = NULL) { foreach ($e->getHeaders() as $header_name => $header_value) { drupal_add_http_header($header_name, $header_value); } + + if ($e->getCode() < 500) { + // Even though it's an exception, it's in fact not a server error - it + // might be just access denied, or a bad request, so we just want to log + // it, but without marking it as an actual exception. + watchdog('restful', $e->getMessage()); + } + else { + // This one should really be considered as an error. + watchdog_exception('restful', $e); + } } catch (Exception $e) { $result = array( @@ -534,6 +545,8 @@ function restful_menu_process_callback($resource_name, $version = NULL) { 'title' => $e->getMessage(), 'status' => 500, ); + + watchdog_exception('restful', $e); } // Adhere to the API Problem draft proposal.