> For the complete documentation index, see [llms.txt](https://chihaolu.gitbook.io/all-in-one-solidity/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chihaolu.gitbook.io/all-in-one-solidity/part-ii-medium/chapter-9-yi-chang-chu-li-handling-exception/answer.md).

# 【Answer】

* Practice 1
* Practice 2
* Practice 3
* Practice 4
* Practice 5

```solidity
pragma solidity ^0.8.11
contract StartStopContract {
    address owner;
    
    bool paused; // default false

    constructor() public{
        // constructor is triggered in only once in contract deploy
        owner = msg.sender;
    }
    
    function sendMoney() public payable {
        
    }
    
    function withdrawMoneyTo(address payable _to) public {
        // if(msg.sender == owner) {
        //     _to.transfer(address(this).balance);
        // } else {
        //     new Exception(...)
        // }
        require(msg.sender == owner, "You are not the Owner");
        require(!paused, "Contract is paused");
         _to.transfer(address(this).balance);
    }
    
    function setPaused(bool _paused) public {
        require(msg.sender == owner, "You are not the Owner");
        paused = _paused;
    }
    
    function destroySmartContract(address payable _to) public {
        require(msg.sender == owner, "You are not the Owner");
        selfdestruct(_to);
    }
}
```

* Practice 6

```solidity
try feed.getData(token) returns (uint v) {
    require(1 == 2, "Will revert");  // This will cause the transaction to revert!!
} catch (bytes memory /*lowLevelData*/) {
    return (0);  // Will not get here
}
```
