diff --git a/frappe/exceptions.py b/frappe/exceptions.py
index 6ff53853a0..0f0e212db6 100644
--- a/frappe/exceptions.py
+++ b/frappe/exceptions.py
@@ -266,8 +266,12 @@ class InvalidRemoteException(Exception):
class LinkExpiredError(ValidationError):
- pass
+ http_status_code = 410
+ title = "Link Expired"
+ message = "The link has been expired"
class InvalidKey(ValidationError):
- pass
+ http_status_code = 401
+ title = "Invalid Key"
+ message = "The key you are using is invalid"
diff --git a/frappe/templates/print_format/print_key_expired.html b/frappe/templates/print_format/print_key_expired.html
deleted file mode 100644
index a4fa414d56..0000000000
--- a/frappe/templates/print_format/print_key_expired.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- {{ _("Key Expired")}}
-
-
\ No newline at end of file
diff --git a/frappe/templates/print_format/print_key_invalid.html b/frappe/templates/print_format/print_key_invalid.html
deleted file mode 100644
index 4adb165634..0000000000
--- a/frappe/templates/print_format/print_key_invalid.html
+++ /dev/null
@@ -1,14 +0,0 @@
-