code: @Override
      public void sendError(int sc, String msg) throws IOException {
          if (isCommitted()) {
              throw new IllegalStateException("Cannot set error status - response is already committed");
          }
          notifyBeforeCommit();
          super.sendError(sc, msg);
          setCommitted();
      }
docs: headers relates methods