Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions app/model/entity/AsyncJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,21 @@ public function getError(): ?string
return $this->error;
}

/**
* Makes sure the error string fits the data column.
* Truncates and adds ellipsis '...' at the end if it overflows.
*/
private function sanitizeErrorLength(): void
{
if ($this->error !== null && strlen($this->error) > 250) {
$this->error = substr($this->error, 0, 250) . '...';
}
}

public function setError(?string $error)
{
$this->error = $error;
$this->sanitizeErrorLength();
}

public function appendError(string $error)
Expand All @@ -223,6 +235,7 @@ public function appendError(string $error)
} else {
$this->error .= "\n$error";
}
$this->sanitizeErrorLength();
}

/**
Expand Down