Skip to content

Commit

Permalink
fix: better error msg for X-token registration
Browse files Browse the repository at this point in the history
    This fix the first point of the issue #405.
  • Loading branch information
EmileRolley committed Jul 20, 2021
1 parent e82c23e commit e27415c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/state/learnocaml_store.ml
Expand Up @@ -339,7 +339,9 @@ module Token = struct

let register ?(allow_teacher=false) token =
if not allow_teacher && is_teacher token then
Lwt.fail (Invalid_argument "Registration of teacher token not allowed")
Lwt.fail
(Invalid_argument "Registration of teacher token forbidden. \
Logout and use a new teacher token?")
else
Lwt.catch (fun () ->
Lwt_io.with_file ~mode:Lwt_io.Output ~perm:0o700 (save_path token)
Expand Down

0 comments on commit e27415c

Please sign in to comment.