File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ import os
2
+ import sys
3
+ import traceback
4
+
5
+ from dokuWikiDumper .__version__ import DUMPER_VERSION
6
+
7
+
1
8
class VersionOutdatedError (Exception ):
2
9
def __init__ (self , version ):
3
10
self .version = version
@@ -84,3 +91,22 @@ def __str__(self):
84
91
return "Revision list not found for [[%s]]" % self .title
85
92
86
93
94
+ def show_edge_case_warning (** context ):
95
+ if int (os .environ .get ('EDGECASE_OK' , '0' )):
96
+ return
97
+
98
+ print (
99
+ "[WARNING]\n "
100
+ "--------------------------------------------\n "
101
+ "The program is about to enter an edge case code, "
102
+ "which lacks real world testing, I'm not sure if the code that runs next can handle it properly. "
103
+ "So I hope you could paste the following details to <https://github.com/saveweb/dokuwiki-dumper/discussions> "
104
+ "to help me improve the code, Thanks!" )
105
+ print ("------------------------------------------" )
106
+ calledfrom = traceback .extract_stack (limit = 2 )[0 ]
107
+ print ("VERSION:" , DUMPER_VERSION )
108
+ print ("FUNC:" , f'{ calledfrom .filename } :{ calledfrom .lineno } ' , "FUNC:" , calledfrom .name )
109
+ print ("CONTEXT:" , context )
110
+ print ("------------------------------------------" )
111
+ print ("To continue executing the edge case code, re-run with --edgecase-ok" )
112
+ sys .exit (13 )
You can’t perform that action at this time.
0 commit comments