Looking for specific string in an exception message in Java

I have a library with a method that throws an IOException. Something like,

package helpful.library;

import java.io.IOException;
import org.apache.http.HttpStatus;

public class HelpfulClass{

    public MyObject MyMethod(String a) throws IOException {
        //does some stuff
        return helpfulMethod(String a);
    }

    private MyObject helpfulMethod(String a, int b) throws IOException {
        //does some stuff that includes retrieving a status code x
        if (x != HttpStatus.SC_OK) {
            throw new IOException("blah blah code: " + x);
        } 
        //does stuff and returns a MyObject object
    }

I want to call MyMethod from another app, and I would like to check for a specific status code (x in helpfulMethod) that is not HttpStatus.SC_OK. In Java is it good practice to use the exception message and check if the string contains my status code? Are there other ways to do it? A possible idea is to change MyObject to throw another exception but that has a ripple effect on other apps that are expecting an IOException only.