Problem/Motivation
There are quite a few issues for improving or adding message to the SkipRowExceptions in some process plugins. So I asked myself if the other process plugins could use similar improvement, thus this meta to see what needs to be done.
There are suggestions to add the destination property (#7) and the migration name (#8) and in one of the child issues heddn suggested 'as much context as possible'.
There is this to add file and line number #2976098: MigrateExecutable should add details for the migration & destination property to exceptions that cause a row failure.
Using that as a guide each process plugin should have the destination property and the migration name as a minimum, and then more added as needed for that particular process plugin. When in doubt, refer to the coding standards for Php Exceptions.
The child issues for each process plugin can probably be novice issues as well.
These plugin throw exceptions
- Extract - #3148959: Improve migrate messages from the extract plugin
- Flatten - #2960170: Add validation to Flatten process plugin
- MigrationLookup - #2959143: Log message if migration_lookup skips on empty
- SkipOnEmpty - #2959151: Log message if skip_on_empty plugin skips on empty
- SkipRowIfNotSet - Only throws a supplied configuration message
These plugins do not throw exceptions
- Callback
- DefaultValue
- DedupeBase
- DedupeEntity
- EntityExists
- FieldFormatterSettingsDefaults
- Get
- Log
- MachineName
- MakeUniqueBase
- MakeUniqueEntityField
- Route
- SubProcess
These plugins throw exceptions and have messages that don't seem to need improvement or has been fixed. Make a new issue if you disagree. And the final message will be improved when #2959444: [Meta] Improve exception messages in process plugins is fixed.
- ArrayBuild
- BlockVisibiliity
- Concat
- ConvertTokens-
- Download
Explode - #3015821: Explode.php exception messages are missing full stops- FieldTypeDefaults - d6 version only
- FileCopy
FormatDate - #3004718: Better MigrateException message in the format_date process plugin- LanguageNegotiation
- LanguageTypes
- LinkUri-
- MenuLinkParent
- NullCoalesce
- ProcessField
- StaticMap
- Substr
- UrlEncode
Proposed resolution
Add as much context as sensible to each process plugin.
Remaining tasks
Review a process plugin and if the exception message needs improvement then make an issue. If not sure ask here.
Original work
Process plugins improved in the first round, before the move to adding destination property, migration name and anything deemed necessary.
- MenuLinkParent.php - #2959106: Log message if menu_link_parent plugin skip the row
- Migration.php - #2959097: Log message if migration plugin skip the row When there is no destination found.
- StaticMap.php - #2951715: Log message if static_map plugin skips the row
- Migration - #2959097: Log message if migration plugin skip the row When there is no destination found.
- BlockVisibiliity - #2959087: Log message if block_visibility plugin skip the row
Comments
Comment #2
dwwI love this issue and what it's trying to coordinate / accomplish. Logging useful messages during migrations would be a huge win for the DX of folks writing/running migrations.
Meanwhile, I added another child issue that's related to this: #2960204: Make it possible for optional log messages from *skip* process plugins to contain context. It's not exactly in scope for what this task/plan is about, but I figured it was close enough to justify putting it under this. If anyone strongly objects, feel free to clear its parent issue reference field and it can stand alone.
Thanks,
-Derek
Comment #3
quietone commentedRead through the migrate process plugins and updated the IS. Added in information for current issues. Looks like rakesh.gectcr did a great job identifying all the skips processes that need better exception messages.
TODO:
Check plugins in other modules.
Add an issue for SkipRowIfNotSet
Comment #4
quietone commentedGrepped for throws in all other process plugins and added them to the list.
Comment #5
quietone commentedChanged title since this is just the exception messages.
Comment #7
quietone commentedAdding issue for format date.
The suggestion in that issue is to add the destination property to the exception message. It might be a good idea to add the destination property to all the process plugin exception messages. Just a thought.
Comment #8
joachim commented> It might be a good idea to add the destination property to all the process plugin exception messages. Just a thought.
Yes, we should definitely add the destination property to all process plugin exceptions.
I was actually thinking of filing an issue to generalize that, but I didn't know this one existed.
I would say also that the migration name needs to be given in the exception message, as when stubs are being created, you can be several migrations away from the one you are actually running.
Comment #9
quietone commentedUpdate the IS to move this add more context to the messages and clear the committed issues from the list as they need to be double checked to see if they need more detail added.
Comment #10
joachim commentedI was wondering if there was a way we could enhance the DX of this, either by providing a method in ProcessPluginBase, or by having the migrate system catch any process exceptions & rethrow them with the standard list of details.
Comment #11
quietone commentedYes, let's find a better way to do this!
Add two issues about error messages to related issues.
Comment #12
jofitzAdd Explode.php child issue.
Comment #13
quietone commentedAdd the coding standard for exceptions to the IS.
Comment #14
quietone commentedAdding in a comment from heddn in #2959143: Log message if migration_lookup skips on empty
And Jo Fitzgerald pointed out later in that issues, where do we get the context from?
So far the suggestions solutions are from joachim,
Note that the two related issues offer patches for the improving the exception messages thrown during MigrateExecutable::import(). And with my sense of consistency I think it would be worth handling the process exception in import() as well.
Any thoughts?
Comment #17
wim leersShouldn't this be bumped to priority?
Comment #18
wim leers(Also made this the parent for #2969231: errors in migration process configuration don't give a clear message and #2969551: Migrate messages from caught exceptions need file and line details.)
Comment #20
benjifisherI just added #3148959: Improve migrate messages from the extract plugin as a child issue, so I am adding it to the issue summary here.
I see that #2976098: MigrateExecutable should add details for the migration & destination property to exceptions that cause a row failure has been added as a child issue but not mentioned in the comments here. That issue will add the destination property (#7) and the migration name (#8) when the exception is caught. IMO that is a better solution than adding that information when the exception is thrown.
Comment #21
quietone commentedThere is now an issue for Flatten.
Comment #22
quietone commentedWent through the process plugins and briefly reviewed the error messages. To me, they look like they don't need improvement, especially with the migration_id and the destination property name being added in #2976098: MigrateExecutable should add details for the migration & destination property to exceptions that cause a row failure.
Comment #23
quietone commented