|
|
@@ -265,10 +265,15 @@ def save_file(request):
|
|
|
encoding = form.cleaned_data['encoding']
|
|
|
data = form.cleaned_data['contents'].encode(encoding)
|
|
|
|
|
|
- if request.fs.exists(path):
|
|
|
- do_overwrite_save(request.fs, path, data)
|
|
|
- else:
|
|
|
- request.fs.create(path, overwrite=False, data=data)
|
|
|
+ try:
|
|
|
+ if request.fs.exists(path):
|
|
|
+ do_overwrite_save(request.fs, path, data)
|
|
|
+ else:
|
|
|
+ request.fs.create(path, overwrite=False, data=data)
|
|
|
+ except WebHdfsException, e:
|
|
|
+ raise PopupException(_("The file could not be saved"), detail=e.message.splitlines()[0])
|
|
|
+ except Exception, e:
|
|
|
+ raise PopupException(_("The file could not be saved"), detail=e)
|
|
|
|
|
|
messages.info(request, _('Saved %(path)s.') % {'path': os.path.basename(path)})
|
|
|
request.path = reverse("filebrowser.views.edit", kwargs=dict(path=path))
|