Skip to content

Commit

Permalink
api: add User error (reporting allowed): designation for scripts to…
Browse files Browse the repository at this point in the history
… use

there are cases where we known an error is a user error and want to self diagnose an issue for the user but at the same time still want them to be able to send in logs. Such cases might include seeing how common an issue is or finding new issues where previously not thought possible.
  • Loading branch information
theofficialgman committed Sep 29, 2023
1 parent 616412c commit 517cf6a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api
Original file line number Diff line number Diff line change
Expand Up @@ -2318,11 +2318,21 @@ sudo apt install --reinstall lsb_release")
fi

#Individual scripts can self-diagnose by outputting "User error: ", followed by the diagnosis.
#In this case we do not allow sending the error report to Pi-Apps
if grep -q "^User error: " <<<"$errors" ;then
#return all lines of output after a line mentions "User error: "
error_caption+=("$(sed -ne '/^User error: /,$ p' <<<"$errors" | sed 's/^User error: //g')")
error_type="system"
fi

#Individual scripts can self-diagnose by outputting "User error (reporting allowed): ", followed by the diagnosis.
#In this case we still allow sending the error report to Pi-Apps
if grep -q "^User error (reporting allowed): " <<<"$errors" ;then
#return all lines of output after a line mentions "User error (reporting allowed): "
error_caption+=("$(sed -ne '/^User error (reporting allowed): /,$ p' <<<"$errors" | sed 's/^User error (reporting allowed): //g')")
# system internet and package error types are blocked from sending error reports. Specify some other error type.
error_type="unknown"
fi

#if no known error was detected, set the error_type to 'unknown'
[ -z "$error_type" ] && error_type=unknown
Expand Down

1 comment on commit 517cf6a

@Botspot
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

Please sign in to comment.