Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dkan:harvest:register should check for required fields rather than throw exception #4353

Open
paul-m opened this issue Dec 6, 2024 · 1 comment
Labels

Comments

@paul-m
Copy link
Contributor

paul-m commented Dec 6, 2024

Current Behavior

Trying to register a harvest plan without an identifier looks like this:

% ddev drush dkan:harvest:register --extract-uri https://example.com/path/harvest.json
 [error]  Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value: INSERT INTO "harvest_plans" ("data") VALUES (:db_insert_placeholder_0); Array
(
    [:db_insert_placeholder_0] => {"identifier":"","extract":{"type":"Harvest\\ETL\\Extract\\DataJson","uri":"https://example.com/path/harvest.json"},"transforms":[],"load":{"type":"Drupal\\harvest\\Load\\Dataset"}}
)
 in Drupal\mysql\Driver\Database\mysql\ExceptionHandler->handleExecutionException() (line 45 of /var/www/html/docroot/core/modules/mysql/src/Driver/Database/mysql/ExceptionHandler.php). 
 [error]  SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value: INSERT INTO "harvest_plans" ("data") VALUES (:db_insert_placeholder_0); Array
(
    [:db_insert_placeholder_0] => {"identifier":"","extract":{"type":"Harvest\\ETL\\Extract\\DataJson","uri":"[https:\/\/download.cms.gov\/openpayments\/staging\/2025JAN\/summary_entities_hidden.json](https://example.com/path/harvest.json)"},"transforms":[],"load":{"type":"Drupal\\harvest\\Load\\Dataset"}}
)

This is confusing and not helpful.

Expected Behavior

Since the --identifier parameter is basically required, we should ensure that it exists, rather than allow a PDO error to tell us.

Steps To Reproduce

Try to register a harvest without an identifier.

Relevant log output (optional)

No response

Anything else?

No response

@paul-m paul-m added the bug label Dec 6, 2024
@dafeder
Copy link
Member

dafeder commented Dec 17, 2024

Just noting that there's some overlap here with #3329

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants