Skip to content

Commit

Permalink
Error message to expand on assertion.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Sep 9, 2023
1 parent 63d7120 commit 1b5d2c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/pages/p_paper.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ function handle_update($action) {
$conf->feedback_msg($this->ps->decorated_message_list());
return;
}
if (!$this->user->can_view_paper($new_prow)) {
error_log("{$conf->dbname}: user {$this->user->email} #{$this->user->contactId} cannot view new paper #{$new_prow->paperId} because " . json_encode($this->user->perm_view_paper($new_prow)));
}
assert($this->user->can_view_paper($new_prow));

// submit paper if no error so far
Expand Down
8 changes: 7 additions & 1 deletion src/permissionproblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ function count() {

#[\ReturnTypeWillChange]
function jsonSerialize() {
return $this->as_array();
$a = $this->as_array();
if (isset($a["option"])) {
$opt = $a["option"];
'@phan-var PaperOption $opt';
$a["option"] = ["id" => $opt->id, "name" => $opt->name];
}
return $a;
}

/** @return array<string,mixed> */
Expand Down

0 comments on commit 1b5d2c7

Please sign in to comment.