scraper monitoring page
[disclosr.git] / documents / viewDocument.php
blob:a/documents/viewDocument.php -> blob:b/documents/viewDocument.php
--- a/documents/viewDocument.php
+++ b/documents/viewDocument.php
@@ -3,13 +3,20 @@
 include_once('../include/common.inc.php');
 $hash = $_REQUEST['hash'];
 $docsdb = $server->get_db('disclosr-documents');
-$doc = object_to_array($docsdb->get($hash));
+try {
+    $doc = object_to_array($docsdb->get($hash));
+
+} catch (SetteeRestClientException $e) {
+    setteErrorHandler($e);
+}
+
 
 if (!isset($doc['_attachments']) || count($doc['_attachments']) == 0) die ("no attachments");
 $attachments = $doc['_attachments'];
 $attachment_filenames = array_keys($attachments);
 //print_r($attachments);
-$url = $serverAddr.'disclosr-documents/'.$hash.'/'.urlencode($attachment_filenames[0]);
+$url = $serverAddr . 'disclosr-documents/' . $hash . '/' . urlencode($attachment_filenames[0]);
 //echo $url;
 $request = Requests::get($url);
 echo ($request->body);
+