Explorar el Código

Removed exception catch that used to return a 500, and now returns a 404 due to a behavior change

Alejandro Celaya hace 7 años
padre
commit
7530048fbd
Se han modificado 2 ficheros con 0 adiciones y 22 borrados
  1. 0 2
      data/proxies/.gitignore
  2. 0 20
      module/Core/test/Action/PreviewActionTest.php

+ 0 - 2
data/proxies/.gitignore

@@ -78,8 +78,6 @@ class PreviewAction implements MiddlewareInterface
             return $this->generateImageResponse($imagePath);
         } catch (InvalidShortCodeException $e) {
             return $out($request, $response->withStatus(404), 'Not found');
-        } catch (PreviewGenerationException $e) {
-            return $out($request, $response->withStatus(500), 'Preview generation error');
         }
     }
 }

+ 0 - 20
module/Core/test/Action/PreviewActionTest.php

@@ -91,24 +91,4 @@ class PreviewActionTest extends TestCase
 
         $this->assertEquals(404, $resp->getStatusCode());
     }
-
-    /**
-     * @test
-     */
-    public function previewExceptionReturnsNotFound()
-    {
-        $shortCode = 'abc123';
-        $this->urlShortener->shortCodeToUrl($shortCode)->willThrow(PreviewGenerationException::class)
-                                                       ->shouldBeCalledTimes(1);
-
-        $resp = $this->action->__invoke(
-            ServerRequestFactory::fromGlobals()->withAttribute('shortCode', $shortCode),
-            new Response(),
-            function ($req, $resp) {
-                return $resp;
-            }
-        );
-
-        $this->assertEquals(500, $resp->getStatusCode());
-    }
 }