11package io .github .kloping .qqbot ;
22
3- import io .github .kloping .MySpringTool .annotations .AutoStand ;
4- import io .github .kloping .MySpringTool .annotations .AutoStandAfter ;
5- import io .github .kloping .MySpringTool .annotations .Entity ;
6- import io .github .kloping .MySpringTool .h1 .impl .LoggerImpl ;
7- import io .github .kloping .MySpringTool .h1 .impl .component .HttpStatusReceiver ;
8- import io .github .kloping .MySpringTool .interfaces .Logger ;
9- import io .github .kloping .MySpringTool .interfaces .component .HttpClientManager ;
103import io .github .kloping .common .Public ;
114import io .github .kloping .qqbot .api .BotContent ;
125import io .github .kloping .qqbot .entities .Bot ;
136import io .github .kloping .qqbot .entities .qqpd .message .RawMessage ;
147import io .github .kloping .qqbot .http .data .ActionResult ;
8+ import io .github .kloping .qqbot .utils .RequestException ;
9+ import io .github .kloping .spt .annotations .AutoStand ;
10+ import io .github .kloping .spt .annotations .AutoStandAfter ;
11+ import io .github .kloping .spt .annotations .Entity ;
12+ import io .github .kloping .spt .impls .HttpStatusReceiver ;
13+ import io .github .kloping .spt .impls .LoggerImpl ;
14+ import io .github .kloping .spt .interfaces .Logger ;
15+ import io .github .kloping .spt .interfaces .component .HttpClientManager ;
1516import org .fusesource .jansi .Ansi ;
1617import org .jsoup .Connection ;
1718import org .jsoup .nodes .Document ;
@@ -44,6 +45,7 @@ public void after(HttpClientManager manager) {
4445 public void receive (HttpClientManager manager , String url , Integer code , Class <?> interface0 , Method method ,
4546 Connection .Method reqMethod , Class <?> cla , Object o , Document metadata ) {
4647 if (o == null || code == null || metadata == null ) return ;
48+
4749 logger .log (String .format ("Use the (%s) method through the (%s) interface to request " +
4850 "the data obtained by the response code of the (%s) URL is (%s), " +
4951 "and (%s) may be converted to (%s) type Will be processed and filtered" ,
@@ -57,7 +59,6 @@ public void receive(HttpClientManager manager, String url, Integer code, Class<?
5759 Ansi .ansi ().fgRgb (LoggerImpl .NORMAL_LOW_COLOR .getRGB ()).a (o ).reset ().toString ()
5860 ));
5961 fillAll (cla , o );
60-
6162 Public .EXECUTOR_SERVICE .submit (() -> {
6263 if (o instanceof ActionResult ) {
6364 ActionResult result = (ActionResult ) o ;
@@ -76,6 +77,9 @@ public void receive(HttpClientManager manager, String url, Integer code, Class<?
7677 }
7778 }
7879 });
80+ if (code >= 400 || code < 200 ) {
81+ throw new RequestException (code , metadata .body ().wholeText (), url , method .getName ());
82+ }
7983 }
8084
8185 public void fillAll (Class <?> cla , Object o ) {
0 commit comments