diff --git a/lib/rasn1/types/base.rb b/lib/rasn1/types/base.rb
index <HASH>..<HASH> 100644
--- a/lib/rasn1/types/base.rb
+++ b/lib/rasn1/types/base.rb
@@ -115,7 +115,11 @@ module Rasn1
           if primitive?
             raise ASN1Error, "malformed #{type} TAG (#@name): indefinite length forbidden for primitive types"
           else
-            raise ASN1Error, "TAG #@name: indefinite length not supported yet"
+            if ber
+              raise NotImplementedError, "TAG #@name: indefinite length not supported yet"
+            else
+              raise ASN1Error, "TAG #@name: indefinite length forbidden in DER encoding"
+            end
           end
         elsif length < INDEFINITE_LENGTH
           der_to_value(der[2, length], ber: ber)
diff --git a/spec/types/base_spec.rb b/spec/types/base_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/types/base_spec.rb
+++ b/spec/types/base_spec.rb
@@ -94,7 +94,9 @@ module Rasn1::Types
         expect { bool.parse!(der) }.to raise_error(Rasn1::ASN1Error).
           with_message('malformed BOOLEAN TAG (bool): indefinite length forbidden for primitive types')
       end
-      it 'raises on indefinite length with constructed types'
+
+      it 'raises on indefinite length with constructed types on DER encoding'
+      it 'raises on indefinite length with constructed types on BER encoding'
     end
   end
 end
Types::Base#parse!: differentiate BER and DER encoding on indefinite length