File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -211,9 +211,21 @@ public function getError(): ?string
211211 return $ this ->error ;
212212 }
213213
214+ /**
215+ * Makes sure the error string fits the data column.
216+ * Truncates and adds ellipsis '...' at the end if it overflows.
217+ */
218+ private function sanitizeErrorLength (): void
219+ {
220+ if ($ this ->error !== null && strlen ($ this ->error ) > 250 ) {
221+ $ this ->error = substr ($ this ->error , 0 , 250 ) . '... ' ;
222+ }
223+ }
224+
214225 public function setError (?string $ error )
215226 {
216227 $ this ->error = $ error ;
228+ $ this ->sanitizeErrorLength ();
217229 }
218230
219231 public function appendError (string $ error )
@@ -223,6 +235,7 @@ public function appendError(string $error)
223235 } else {
224236 $ this ->error .= "\n$ error " ;
225237 }
238+ $ this ->sanitizeErrorLength ();
226239 }
227240
228241 /**
You can’t perform that action at this time.
0 commit comments