./src/backend/utils/errcodes.txt:01P01 W ERRCODE_WARNING_DEPRECATED_FEATURE deprecated_feature
I am using PostgreSQL 10.1, I apologize in case it has already been fixed in 10.2 or 10.3.
While I haven't looked at the source code or docs for this I'm wondering why you believe this is a bug in the first place. If "01P01" is a valid and expected value for ERRCODE I would expect that the textual string label representing it would not be. The two are not likely to be interchangeable. Have you found working code where this is does work as you expect?