Fix seed imports

This commit is contained in:
Dane Everitt 2020-06-25 21:16:59 -07:00
parent b55767426f
commit da39d9177e
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 26 additions and 7 deletions

View file

@ -76,7 +76,16 @@ class EggImporterService
public function handle(UploadedFile $file, int $nest): Egg
{
if ($file->getError() !== UPLOAD_ERR_OK || ! $file->isFile()) {
throw new InvalidFileUploadException(trans('exceptions.nest.importer.file_error'));
throw new InvalidFileUploadException(
sprintf(
'The selected file ["%s"] was not in a valid format to import. (is_file: %s is_valid: %s err_code: %s err: %s)',
$file->getFilename(),
$file->isFile() ? 'true' : 'false',
$file->isValid() ? 'true' : 'false',
$file->getError(),
$file->getErrorMessage()
)
);
}
$parsed = json_decode($file->openFile()->fread($file->getSize()));