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

Improve Migration CLI and Exception classes #34

Merged
merged 3 commits into from
Jun 13, 2024

Conversation

PineappleIOnic
Copy link
Member

This PR pushes the exception resource name into the exception class so we can access it easier in our analytics and migration CLI

public string $resourceType;

public string $resourceId;

public function __construct(string $resourceType, string $message, int $code = 0, ?\Throwable $previous = null, string $resourceId = '')
public function __construct(string $resourceName, string $resourceType, string $message, int $code = 0, ?\Throwable $previous = null, string $resourceId = '')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about name of variables. If one is Storage and one is Bucket, I think we should do $service and $resource

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migration lib is supposed to be agnostic so it's all called groups throughout the library, changing it here would mean we would have to change it everywhere. We could probably change the terminology for G2 but I think we should keep it the same for G1

src/Migration/Exception.php Outdated Show resolved Hide resolved
Comment on lines 464 to 468
new Exception(
Resource::TYPE_DATABASE,
Transfer::GROUP_DATABASES,
$e->getMessage()
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should pass $e as previous everywhere we can, that way the stack trace will include the trace from the original exception too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're passing $e we could get rid for code and message and just defer it off previous, wdyt?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to keep them separate; we might not want to defer every message/code to previous

@abnegate abnegate merged commit 4c6f44d into main Jun 13, 2024
2 checks passed
@abnegate abnegate deleted the fix-improve-migration-exceptions branch June 13, 2024 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants