TypeError: Exception::__construct(): Argument #2 ($code) must be of type int

Created on 7 August 2025, 6 days ago

Problem/Motivation

We have encountered while calling the import method of the asset repository a TypeError:
TypeError: Exception::__construct(): Argument #2 ($code) must be of type int, null given in Exception->__construct() (line 85 of modules/contrib/acquia_dam/src/AssetRepository.php).

https://git.drupalcode.org/project/acquia_dam/-/blob/1.1.x/src/AssetRepo...

Steps to reproduce

Not entirely sure why, but I checked with xdebug and the asset is found, but without a released_and_not_expired key in it, which triggers this exception, but the exception_code is not part of the asset, resulting in the error mentioned above.

Proposed resolution

Only throw the AssetImportException if the asset's exception_code is available.

🐛 Bug report
Status

Active

Version

1.1

Component

Code

Created by

🇪🇸Spain manuel garcia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024