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

[Migrate Tag Naming Strategy Command] Fetch Inline Exceptions #4870

Open
solverat opened this issue Aug 20, 2019 · 2 comments

Comments

@solverat
Copy link
Contributor

commented Aug 20, 2019

I just spend two days migrating a huge project from P4 to P5. The tag naming migration command (render) works quite nice but i also struggeled with the area inline exceptions. If an exception rises within the area rendering, the migration service won't notice it, because it's just a rendered string. This is quite dangerous, since a lot of elements get skipped silently.

I fixed that locally:

$content = Document\Service::render(
    $document,
    [],
    false,
    ['pimcore_editmode' => true]
);

if (strpos($content, 'color:#f00') !== false) {
    preg_match_all('/<b style=\"color:#f00\">(.*?)<\/b>/s', $content, $matches);
    $excerptStart = strpos($content, $matches[1][0]);
    $message = substr($content, $excerptStart, 10000);
    throw new \Exception(sprintf('Inline error! Error: %s. Trace (excerpt): %s...',
        (is_array($matches[1]) ? join(', ', $matches[1]) : '--'), $message)
    );
}

pretty nasty, huh? 😄

My question: Should i provide a PR for that? If yes: Which branch? I think it could be useful to do this within P5 but i need you're advice for that first.

Thanks!

@dpfaffenbauer

This comment has been minimized.

Copy link
Contributor

commented Aug 26, 2019

Honestly, I think that catching exceptions in a brick is the real issue here.... My reason for that is: you can not globally handle exceptions thrown inside bricks: #4353

@solverat

This comment has been minimized.

Copy link
Contributor Author

commented Aug 27, 2019

We just had the same within the xliff export. The export won't notice inline exceptions and therefor a lot of translations could get lost. So yes, like @dpfaffenbauer suggested, we should bubble up those exceptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.