Ended up using a RewriteCond redirection instead of ErrorDocument, resulting in a "rule" for the file to be redirected. Basically something like this:
RewriteCond %{REQUEST_URI} !^/app
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /404.php
Basically this means, "if file requested is not valid file, use this rewriterule". The first condition is to make sure it excludes the "app" folder, so it handles its own errors.