22namespace ParagonIE \Chronicle \Handlers ;
33
44use GuzzleHttp \Exception \GuzzleException ;
5- use ParagonIE \Chronicle \{
6- Chronicle ,
5+ use ParagonIE \Chronicle \{Chronicle ,
6+ Exception \ BaseException ,
77 Exception \ChainAppendException ,
88 Exception \ClientNotFound ,
99 Exception \FilesystemException ,
1010 Exception \SecurityViolation ,
1111 Exception \TargetNotFound ,
1212 HandlerInterface ,
13- Scheduled
14- };
13+ Scheduled };
1514use ParagonIE \Sapient \CryptographyKeys \SigningPublicKey ;
1615use ParagonIE \Sapient \Exception \InvalidMessageException ;
1716use ParagonIE \Sapient \Sapient ;
@@ -36,6 +35,7 @@ class Publish implements HandlerInterface
3635 * @param array $args
3736 * @return ResponseInterface
3837 *
38+ * @throws BaseException
3939 * @throws ChainAppendException
4040 * @throws ClientNotFound
4141 * @throws FilesystemException
@@ -99,11 +99,17 @@ public function __invoke(
9999 // If we need to do a cross-sign, do it now:
100100 (new Scheduled ())->doCrossSigns ();
101101
102+ try {
103+ $ now = (new \DateTime ())->format (\DateTime::ATOM );
104+ } catch (\Exception $ ex ) {
105+ return Chronicle::errorResponse ($ response , $ ex ->getMessage (), 500 );
106+ }
107+
102108 return Chronicle::getSapient ()->createSignedJsonResponse (
103109 200 ,
104110 [
105111 'version ' => Chronicle::VERSION ,
106- 'datetime ' => ( new \ DateTime ())-> format (\DateTime:: ATOM ) ,
112+ 'datetime ' => $ now ,
107113 'status ' => 'OK ' ,
108114 'results ' => $ result
109115 ],
@@ -119,6 +125,7 @@ public function __invoke(
119125 * @param RequestInterface $request
120126 * @return array
121127 *
128+ * @throws BaseException
122129 * @throws SecurityViolation
123130 * @throws ClientNotFound
124131 */
0 commit comments