Permalink
Browse files

Added some code to show a better error message on failure.

  • Loading branch information...
1 parent 4c1d23e commit 705c8e4c108cda7462aa0dbe5e39c6a7b3e23f9d @davidw davidw committed Mar 18, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/boss_db.erl
View
6 src/boss_db.erl
@@ -92,10 +92,12 @@ migrate(Migrations) when is_list(Migrations) ->
end).
%% @doc Run database migration {Tag, Fun} in Direction
-migrate({Tag, Fun}, Direction) ->
+migrate({Tag, Fun}, Direction) when is_atom(Tag) ->
io:format("Running migration: ~p ~p~n", [Tag, Direction]),
Fun(Direction),
- db_call({migration_done, Tag, Direction}).
+ db_call({migration_done, Tag, Direction});
+migrate({Tag, _Fun}, _Direction) ->
+ throw(lists:flatten("Tag is not an atom: " ++ Tag)).
%% @spec find(Id::string()) -> Value | {error, Reason}
%% @doc Find a BossRecord with the specified `Id' (e.g. "employee-42") or a value described

0 comments on commit 705c8e4

Please sign in to comment.