We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

How to throw error during install of module

Development and Programming

Bjørn Børresen's avatar
Bjørn Børresen
629 posts
16 years ago
Bjørn Børresen's avatar Bjørn Børresen

When installing my module I want to check some site config settings and if my requirements are not met I want to notify the user that the module was not installed.

How do I do this (can’t seem to find anything about this in the module development docs).

       
Bjørn Børresen's avatar
Bjørn Børresen
629 posts
16 years ago
Bjørn Børresen's avatar Bjørn Børresen

bump - nobody knows?

  • bjorn
       
Derek Jones's avatar
Derek Jones
7,561 posts
16 years ago
Derek Jones's avatar Derek Jones
return $DSP->error_message('Your error message');
       
Bjørn Børresen's avatar
Bjørn Børresen
629 posts
16 years ago
Bjørn Børresen's avatar Bjørn Børresen

Hi Derek,

that doesn’t seem to work. It will just say “Module installed” in the yellow flash message at the top.

If you look at the module though it will say “Not installed” (since I abort the install when setting that error message).

It’s important to note that this is during install (in the _module_install() function). Maybe that has something to do with it?

  • bjorn
       
Derek Jones's avatar
Derek Jones
7,561 posts
16 years ago
Derek Jones's avatar Derek Jones

Yes, my mistake, as the module home page that is called overwrites the page body set by the Display class error_message() method. You can use

return $OUT->fatal_error('Your error message');

Which halts script execution and uses the user error message specialty template to display the error.

       
Bjørn Børresen's avatar
Bjørn Børresen
629 posts
16 years ago
Bjørn Børresen's avatar Bjørn Børresen

Thanks Derek, that worked 😊

  • bjorn
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.