title: Flutter : Dio HTTP Handling error exception 404
body: <h1>My Expect</h1>
  <p><a href="https://i.stack.imgur.com/PJqxD.gif" rel="nofollow noreferrer">It's using Http.get</a></p>
  <p>I'm got problem with handling error Exception <strong>DIO</strong> package , I'm try in <strong>HTTP</strong> package it's work with this code:</p>
  <pre><code> Future&lt;List&lt;Mosque&gt;&gt; getMahasiswaById(String id) async{
         try {
           var apiRespon = await http.get('$baseURL/mahasiswa/get/id/$id');
          if(apiRespon.statusCode == 200){
              final apiResponJson = json.decode(apiRespon.body);
              return (apiResponJson['data'] as List).map((p)=&gt;Mosque.fromJson(p)).toList();
          }else{
            print(apiRespon.statusCode.toString());
              throw Exception('Failed Load Data with status code ${apiRespon.statusCode}');
          }
         }on Exception catch (e) {
           print(e);
           return null;
         }
    }
  </code></pre>
  <p>But if I change with <strong>DIO</strong> my app suddenly crash with error Exception even though I'm already handling this exception :</p>
  <pre><code> Future&lt;List&lt;Mosque&gt;&gt; getMahasiswaById(String id) async{
         try {
           var apiRespon = await dio.get('$baseURL/mahasiswa/get/id/$id');
          if(apiRespon.statusCode == 200){
              final apiResponJson = apiRespon.data;
              return (apiResponJson['data'] as List).map((p)=&gt;Mosque.fromJson(p)).toList();
          }else{
            print(apiRespon.statusCode.toString());
              throw Exception('Failed Load Data with status code ${apiRespon.statusCode}');
          }
         }on DioError catch (e) {
           print(e);
           return null;
         }
    }
  </code></pre>
  <p>My exception:</p>
  <blockquote>
  <p>error : null<br />
  message :&quot;Http status error [404]&quot;<br />
  Response ({&quot;status&quot;:false,&quot;message&quot;:&quot;Data Not Found&quot;})</p>
  </blockquote>
  <p>I've already opened issue in github but not yet get solution.</p>
  <p>Thanks</p>
  <p><a href="https://i.stack.imgur.com/pUU33.png" rel="nofollow noreferrer">This is my exception</a></p>