File tree Expand file tree Collapse file tree 2 files changed +19
-8
lines changed Expand file tree Collapse file tree 2 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,15 @@ class ServerOutOfTempSpaceError(OutOfSpaceError):
124
124
error_message = "The isolated environment where the document conversion take space ran out of space"
125
125
126
126
127
+ class ClientOutOfTMPSpaceError (OutOfSpaceError ):
128
+ """The client ran out of space"""
129
+
130
+ error_code = ERROR_SHIFT + 72
131
+ error_message = (
132
+ "You computer ran out of temporary storage space during the document conversion"
133
+ )
134
+
135
+
127
136
class UnexpectedConversionError (PDFtoPPMException ):
128
137
error_code = ERROR_SHIFT + 100
129
138
error_message = "Some unexpected error occurred while converting the document"
Original file line number Diff line number Diff line change @@ -135,14 +135,16 @@ def __convert(
135
135
timeout = sw .remaining ,
136
136
)
137
137
138
- # Wrapper code
139
- with open (f"/tmp/dangerzone/page-{ page } .width" , "w" ) as f_width :
140
- f_width .write (str (width ))
141
- with open (f"/tmp/dangerzone/page-{ page } .height" , "w" ) as f_height :
142
- f_height .write (str (height ))
143
- with open (f"/tmp/dangerzone/page-{ page } .rgb" , "wb" ) as f_rgb :
144
- f_rgb .write (untrusted_pixels )
145
-
138
+ try :
139
+ # Wrapper code
140
+ with open (f"/tmp/dangerzone/page-{ page } .width" , "w" ) as f_width :
141
+ f_width .write (str (width ))
142
+ with open (f"/tmp/dangerzone/page-{ page } .height" , "w" ) as f_height :
143
+ f_height .write (str (height ))
144
+ with open (f"/tmp/dangerzone/page-{ page } .rgb" , "wb" ) as f_rgb :
145
+ f_rgb .write (untrusted_pixels )
146
+ except OSError :
147
+ raise errors .ClientOutOfTMPSpaceError ()
146
148
percentage += percentage_per_page
147
149
148
150
text = f"Converting page { page } /{ n_pages } to pixels"
You can’t perform that action at this time.
0 commit comments