diff --git a/externallib.php b/externallib.php
index f795b3245540e360c62ec87f54aaaa763b3e4c04..8de05c025a24bed66d7f4a6b27737280cca4aebb 100644
--- a/externallib.php
+++ b/externallib.php
@@ -35,7 +35,7 @@ class mod_vpl_webservice extends external_api {
             throw new Exception( get_string( 'opnotallowfromclient', VPL ) . ' ' . getremoteaddr() );
         }
         if (! $vpl->pass_password_check( $password )) {
-            throw new Exception( get_string( 'requiredpassword', VPL ) );
+            throw new moodle_exception('requiredpassword', VPL);
         }
         return $vpl;
     }