Commit 32969599 authored by Andreas Heimann's avatar Andreas Heimann

added graceful errors for uploading

parent 00acfe2d
...@@ -184,3 +184,19 @@ ...@@ -184,3 +184,19 @@
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
} }
.flashbang {
padding: 20px;
margin-bottom: 25px;
border: 2px solid #fff;
border-radius: 6px;
}
.flashbang.flashbang-success {
background: rgba(121, 223, 90, 0.1);
border-color: #79df5a;
color: #79df5a;
}
.flashbang.flashbang-error {
background: rgba(197, 65, 76, 0.1);
border-color: #c5414c;
color: #c5414c;
}
...@@ -158,3 +158,20 @@ ...@@ -158,3 +158,20 @@
justify-content: flex-end; justify-content: flex-end;
} }
} }
.flashbang {
padding: 20px;
margin-bottom: 25px;
border: 2px solid #fff;
border-radius: 6px;
&.flashbang-success {
background: rgba(121, 223, 90, 0.1);
border-color: #79df5a;
color: #79df5a;
}
&.flashbang-error {
background: rgba(197, 65, 76, 0.1);
border-color: #c5414c;
color: #c5414c;
}
}
\ No newline at end of file
...@@ -112,7 +112,7 @@ class UploadController extends AbstractController ...@@ -112,7 +112,7 @@ class UploadController extends AbstractController
} }
} }
} catch(Exception $e) { } catch(Exception $e) {
var_dump($e); $this->addFlash('error', 'Uploading failed. Please report back to our development team!');
// clean up temp files // clean up temp files
$hf = new HelperFunctions(); $hf = new HelperFunctions();
...@@ -131,7 +131,7 @@ class UploadController extends AbstractController ...@@ -131,7 +131,7 @@ class UploadController extends AbstractController
} }
} }
} catch(Exception $e) { } catch(Exception $e) {
var_dump($e); $this->addFlash('error', 'Uploading failed. Please report back to our development team!');
// clean up temp files // clean up temp files
$hf = new HelperFunctions(); $hf = new HelperFunctions();
...@@ -150,7 +150,7 @@ class UploadController extends AbstractController ...@@ -150,7 +150,7 @@ class UploadController extends AbstractController
} }
} }
} catch(Exception $e) { } catch(Exception $e) {
var_dump($e); $this->addFlash('error', 'Uploading failed. Please report back to our development team!');
// clean up temp files // clean up temp files
$hf = new HelperFunctions(); $hf = new HelperFunctions();
...@@ -186,13 +186,13 @@ class UploadController extends AbstractController ...@@ -186,13 +186,13 @@ class UploadController extends AbstractController
return $this->redirectToRoute('song.detail', ['songId' => $song->getId()]); return $this->redirectToRoute('song.detail', ['songId' => $song->getId()]);
} catch(\Exception $e) { } catch(\Exception $e) {
throw $e; $this->addFlash('error', 'Uploading failed. Please report back to our development team!');
} }
} catch(\Exception $e) { } catch(\Exception $e) {
throw $e; $this->addFlash('error', 'Uploading failed. Please report back to our development team!');
} }
} else { } else {
throw new \Exception("Error when extracting ZIP file"); $this->addFlash('error', 'Uploading failed. Please report back to our development team!');
} }
} }
......
...@@ -5,6 +5,14 @@ ...@@ -5,6 +5,14 @@
{% block content %} {% block content %}
<section class="section-upload"> <section class="section-upload">
{{ form_start(uploadForm) }} {{ form_start(uploadForm) }}
{% for label, messages in app.flashes %}
{% for message in messages %}
<div class="flashbang flashbang-{{ label }}">
{{ message }}
</div>
{% endfor %}
{% endfor %}
<div class="box"> <div class="box">
<div class="title">Upload</div> <div class="title">Upload</div>
<div class="upload-input"> <div class="upload-input">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment