summaryrefslogtreecommitdiff
path: root/includes/lib/general.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/lib/general.php')
-rw-r--r--includes/lib/general.php22
1 files changed, 21 insertions, 1 deletions
diff --git a/includes/lib/general.php b/includes/lib/general.php
index 25d2561..6cfbd10 100644
--- a/includes/lib/general.php
+++ b/includes/lib/general.php
@@ -47,4 +47,24 @@ function get_user_id_from_cert($serial, $issuer_cn)
return -1;
}
-?>
+/**
+* Produces a log entry with the error message with log level E_USER_WARN
+* and a random ID an returns a message that can be displayed to the user
+* including the generated ID
+*
+* @param $errormessage string
+* The error message that should be logged
+* @return string containing the generated ID that can be displayed to the
+* user
+*/
+function failWithId($errormessage) {
+ $errorId = rand();
+ trigger_error("$errormessage. ID: $errorId", E_USER_WARNING);
+ return sprintf(_("Something went wrong when processing your request. ".
+ "Please contact %s for help and provide them with the ".
+ "following ID: %d"),
+ "<a href='mailto:support@cacert.org?subject=System%20Error%20-%20".
+ "ID%3A%20$errorId'>support@cacert.org</a>",
+ $errorId);
+}
+