Again in the need of some hint.

I am exporting some subtree.
There is a custom_id pointing in the same orgĀ 
file but outside of the subtree.

* Foo
:PROPERTIES:
:CUSTOM_ID: foo
:END:

Lorem ipsum...

* Bar

[[#foo]]

When I try to export the second subtree, I get
an error from #'org-export-resolve-id-link.

(user-error Unable to resolve link: "foo")

What is the easiest way to trap this error
so that I can compute something myself for this link ?

Thanks in advance.

Fabrice