summaryrefslogtreecommitdiffstats
path: root/js/app
diff options
context:
space:
mode:
Diffstat (limited to 'js/app')
-rw-r--r--js/app/services/bl/folderbl.coffee10
-rw-r--r--js/app/services/existserror.coffee32
2 files changed, 40 insertions, 2 deletions
diff --git a/js/app/services/bl/folderbl.coffee b/js/app/services/bl/folderbl.coffee
index 6085ca50e..68031371a 100644
--- a/js/app/services/bl/folderbl.coffee
+++ b/js/app/services/bl/folderbl.coffee
@@ -23,9 +23,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory 'FolderBl',
['_Bl', 'FolderModel', 'FeedBl', 'Persistence', 'FeedType', 'ActiveFeed',
-'ItemModel', 'ShowAll',
+'ItemModel', 'ShowAll', '_ExistsError',
(_Bl, FolderModel, FeedBl, Persistence, FeedType, ActiveFeed,
-ItemModel, ShowAll)->
+ItemModel, ShowAll, _ExistsError)->
class FolderBl extends _Bl
@@ -81,6 +81,12 @@ ItemModel, ShowAll)->
return @_folderModel.getAll()
+ create: (folderName) ->
+ if @_folderModel.nameExists(folderName)
+ throw new _ExistsError()
+
+
+
return new FolderBl(FolderModel, FeedBl, ShowAll, ActiveFeed, Persistence,
FeedType, ItemModel)
diff --git a/js/app/services/existserror.coffee b/js/app/services/existserror.coffee
new file mode 100644
index 000000000..cb9fab54e
--- /dev/null
+++ b/js/app/services/existserror.coffee
@@ -0,0 +1,32 @@
+###
+
+ownCloud - News
+
+@author Bernhard Posselt
+@copyright 2012 Bernhard Posselt nukeawhale@gmail.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+###
+
+
+angular.module('News').factory '_ExistsError', ->
+
+ class ExistsError extends Error
+
+ constructor: (message='') ->
+ super(message)
+
+
+ return ExistsError \ No newline at end of file