cancel
Showing results for 
Search instead for 
Did you mean: 

Developing Magento 2 extension

SOLVED

Developing Magento 2 extension

How To: What Replaces Mage::throwException($errorMsg); in Magento 2?

if ($errorMsg) 
    {
      Mage::throwException($errorMsg);
    }

and  Mage::getUrl

 

public function getOrderPlaceRedirectUrl()
  {
    return Mage::getUrl('skypay/payment/redirect', array('_secure' => false));
  }

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Developing Magento 2 extension

Try to use like this :

catch (\Exception $e) {
                throw new \Magento\Framework\Exception\LocalizedException(__('%1', $e->getMessage()));
            }

or

 

 

if ($errorMsg) 
{
  throw new \Exception($errorMsg);
}


For second code solution :

 

$this->_url->getUrl('skypay/payment/redirect', ['_secure' => false]);



It may be helpful for you.

If issue solved , Click Kudos & Accept as Solution

View solution in original post

Re: Developing Magento 2 extension

@bbbmishucs

please check my updated answer and accept solution if it is useful for you.

View solution in original post

4 REPLIES 4

Re: Developing Magento 2 extension

Try to use like this :

catch (\Exception $e) {
                throw new \Magento\Framework\Exception\LocalizedException(__('%1', $e->getMessage()));
            }

or

 

 

if ($errorMsg) 
{
  throw new \Exception($errorMsg);
}


For second code solution :

 

$this->_url->getUrl('skypay/payment/redirect', ['_secure' => false]);



It may be helpful for you.

If issue solved , Click Kudos & Accept as Solution

Re: Developing Magento 2 extension

Thanks @rohanhapani .

Now tell me how can I change last part

Re: Developing Magento 2 extension

@bbbmishucs

please check my updated answer and accept solution if it is useful for you.

Re: Developing Magento 2 extension

I'm a Magento Developer with 6 years of experience in the field. To Hire Magento Developers for your ecommerce project contact me now!